import led8 , utime
from machine import Pin, SPI,RTC
import machine
import wifi
def showall():
    t=rtc.datetime()
    display.show([t[6]%10,t[6]//10,10,t[5]%10,t[5]//10,10,t[4]%10,t[4]//10])
def f():
    spi = SPI(1, baudrate=10000000, polarity=1, phase=0, sck=Pin(4), mosi=Pin(5))
    ss = Pin(1, Pin.OUT)
    display = led8.led8x8(spi, ss)
    display.brightness(15)
    rtc = machine.RTC()
    showall()
    wifi.sync()
    showall()
    while True:
        t=rtc.datetime()
        if(t[6]%10 == 0):
            if(t[6]==0):
                showall()
            else:
                display.show([t[6]%10,t[6]//10])
        else:
            display.show([t[6]%10])
        utime.sleep(1)
#         machine.lightsleep(int((1000000-t[7])/1000))
